package com.spider.method1reference;

import com.spider.innerclass3.Student;

import java.util.Arrays;

public class Demo2 {
    public static void main(String[] args) {
        test1();
    }
    public static void test1(){
        //目标：完成给数组排序，理解其中匿名内部类的用法
        //准备一个学生类型的数组，存放6个学生对象。
        Student[] students = new Student[6];
        students[0] = new Student("殷素素",35,175.1,'女');
        students[1] = new Student("张三",18,180.1,'男');
        students[2] = new Student("王五",19,170.1,'男');
        students[3] = new Student("赵六",20,165.1,'女');
        students[4] = new Student("小七",17,160.1,'女');
        students[5] = new Student("小八",16,155.1,'女');
        Student t = new Student();
        //Arrays.sort( students,  Student::compareByAge);
        Arrays.sort( students,  t::compareByheight);
        for (int i = 0; i < students.length; i++) {
            Student s = students[i];
            System.out.println(s);
        }
    }
}
